<?php
class SitemapAction extends CommonAction {
    public function index(){
    $news = D('News');
    $today = date("Y-m-d", time());
    $yesterday = mktime(0, 0, 0, date("m"), date("d") - 1, date("Y"));
    $lastweek = strtotime("-1 week");
    //$link = M();
    //$yesterdayArr = $link ->query("select * from pre_sethouse where status=1 and time>$yesterday"); //昨天
    //$lastweekArr = $link ->query("select * from pre_sethouse where status=1 and time>$lastweek"); //上周
    //$url = "http://www.xxx.com/House/housecontent/id/";
	$newsArr=$news->__list('n','c','m','n.status=1 and n.site_id='.__RELATEID__,'n.sort,n.id desc','200');
	//echo $news->getLastSql();
	//dump($newsArr);

    $content = '<html>
<head>
<title>Sitemap_html</title>
<meta http-equiv="Content-type" content="text/html;" charset="utf-8" />
<style>BODY {font-size: 80%;}</style>
</head>
<body> 
<table border="0" width="60%" align="center">
<tr><td>创建于:'.date('Y-m-d').'<br /><br /></td></tr>
';
    foreach($newsArr as $k=>$v) {
        $content.='<tr><td><a href="'.U('/'.$v['category_name'].'/'.$v['id'],'',true,false,true).'">'.$v['title'].'</a></td></tr>';
    }
    $content.= '</table>
</body>';
    echo $content;
    //$fp = fopen('sitemap.html', 'w+');
    //fwrite($fp, $content);
    //fclose($fp);
    
	
    }
}